﻿using System;
using System.Collections.Generic;
using System.Text;
using Tao.OpenGl;
using Tao.Platform.Windows;

namespace TaoGL_UserControl
{
    class Piano:InExPro
    {
        const int conKeyMaxNum = 10;    
        const int conKeyStartWidth = -32;
        const int conPianoKeyWidth = 73;
        const int conPinaoKeyHeight = 768;

        List<PianoKey> m_LstPianoKey;
        //======================================================================
        public Piano()
        {
            m_LstPianoKey = new List<PianoKey>();
            for (int i = 0; i < conKeyMaxNum; i++)
            {
                PianoKey pky = new PianoKey();
                pky.SetLoc((conKeyStartWidth + (conPianoKeyWidth * i)), conPinaoKeyHeight); //設定每個位置
                m_LstPianoKey.Add(pky);
            }
        }
        //======================================================================
        public void Draw()
        {
            foreach (PianoKey pky in m_LstPianoKey)
            {
                Gl.glPushMatrix();
                pky.Draw();
                Gl.glPopMatrix();
            }

        }
        //======================================================================
        public void Process(int tm)
        {
            foreach (PianoKey pky in m_LstPianoKey)
                pky.Process(tm);

        }
    }

}
